/*********************************
 * Author: Nikhil Kishore
 * Date July 11, 2014
 * Description: Testing council_room card
***********************************/


#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include "rngs.h"


int main(){
	return council_roomtest();
}


int council_roomtest(){
	printf("Testing council_room card\n");
	
	char *config = "Config1";
	printf("%s\n", config);
	struct gameState *state = malloc(sizeof(struct gameState));
	char *cardString = "council_room";
	int card = council_room;
	int choice1, choice2, choice3, handPos, bonus;
	
	state->whoseTurn = 0;
	state->numPlayers = 4;
	state->numActions = 1;
	
	state->numBuys = 1;
	state->whoseTurn = 1;
	int i;
	int j;
	for (i = 0 ; i < 25; i ++){
		state->supplyCount[i] = 5;
	}
	for ( i = 0 ; i < state->numPlayers ; i++){
		for (  j = 0 ; j < 25 ; j++ ){
			state->hand[i][j] = 5;
			state->discard[i][j] = 4;
			state->deck[i][j] = 3;
			state->deckCount[i] = 10;
			state->discardCount[i] = 20;
			state->handCount[i] = 7;
		}
	}
	choice1 = 1;
	choice2 = 0;
	choice3 = 0;
	handPos = 1;
	bonus = 1;

	int player =state->whoseTurn ;
	int numActions = state->numActions;
	int handCount = state->handCount[player];
	int deckCount = state->deckCount[player];
	// int discardCount = state->discardCount[player];
	int numBuys = state->numBuys;
	int numPlayers = state->numPlayers;
	if ( cardEffect( card,  choice1, choice2, choice3, state,  handPos, &bonus) == 0){
		printf("Success: cardEffect for %s returned 0\n", cardString);

		if (state->numBuys == numBuys +1){
			printf("Success: Increment numBuys\n");
		} else {
			printf("Failed: increment numBuys\n");
		}

		if (state->handCount[player] == handCount ){
			printf("Success: handcount \n");
		} else {
			printf("Failed: handcount \n");
		}
		
		for(  i = 0; i < numPlayers ; i++){
			if ( i != player ){
				if (state->handCount[i] == 8){
					printf("Success: handcount increment for player %d\n", i);
				} else {
					printf("Failed: handcount increment for player %d\n", i);					
				}
			}
		} 

	}else {
		printf("Failed: cardEffect for council_room didn't return 0\n");
	}
 
	

	printf("End testing council_room card\n\n");
	return 0;
}
